package study.reactive.springboot.webflux;

import cn.hutool.system.SystemUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.context.ConfigurableApplicationContext;
import study.reactive.springboot.webflux.support.SpringBootCfg;

@Slf4j
public class Startup {

    private static final int CPU = Runtime.getRuntime().availableProcessors();

    public static void main(String[] args) {
        /**
         * ==================================================
         * 如何在 SpringBoot 应用设置 Webflux io 线程数
         * （1）提供自己的 ReactiveWebServerFactory 通过 HttpServer 配置选项进行更改
         * （2）Spring Webflux 2.0 正在使用 Reactor-Netty。而 ReactorNetty 类提供了配置
         * ==================================================
         */
        //log.info(">>>>>> {}", CPU);
//        log.info(">>>>>> {}", System.getProperty("reactor.netty.ioWorkerCount"));
        System.setProperty("reactor.netty.ioWorkerCount", "1");
        SystemUtil.get("88");
//        System.setProperty("reactor.netty.ioSelectCount", "1");
//        System.setProperty("reactor.netty.pool.maxConnections", "1");

        ConfigurableApplicationContext ctx = SpringApplication.run(SpringBootCfg.class, args);
    }
}
